package com.jhon.yinji.lichuanvip.fragment;

import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.EditText;

import com.jhon.yinji.lichuanvip.MainActivity;
import com.jhon.yinji.lichuanvip.R;

import org.xutils.view.annotation.ContentView;
import org.xutils.view.annotation.Event;
import org.xutils.view.annotation.ViewInject;

/**
 * Created by yinji on 2016/7/18.
 */
@ContentView(R.layout.fragment_register)
public class RegisterFragment extends BaseFragment {
    @ViewInject(R.id.fr_edt_name)
    private EditText fr_edt_name;
    @ViewInject(R.id.fr_edt_password)
    private EditText fr_edt_password;
    @ViewInject(R.id.fr_edt_idCard)
    private EditText fr_edt_idCard;
    @ViewInject(R.id.fr_edt_phone)
    private EditText fr_edt_phone;
    @ViewInject(R.id.fr_edt_rmdphone)
    private EditText fr_edt_rmdphone;
    @ViewInject(R.id.fr_edt_address)
    private EditText fr_edt_address;
    @ViewInject(R.id.fr_edt_bankNum)
    private EditText fr_edt_bankNum;
    @ViewInject(R.id.fr_edt_cmpName)
    private EditText fr_edt_cmpName;
    @ViewInject(R.id.fr_edt_cmpAdd)
    private EditText fr_edt_cmpAdd;

    @Override
    public void onViewCreated(View view, Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
    }

    @Event(value = R.id.fr_btn_back)
    private void back(View view) {
        MainActivity.switchFtagmet("LoginFragment");
    }

    @Event(value = {R.id.fr_edt_name, R.id.fr_edt_password, R.id.fr_edt_idCard, R.id.fr_edt_phone, R.id.fr_edt_rmdphone, R.id.fr_edt_address, R.id.fr_edt_bankNum},
            type = View.OnFocusChangeListener.class)
    private void focusChange(View v, boolean hasFocus) {
        String content=((EditText)v).getText().toString();
        if(!hasFocus){
            if(TextUtils.isEmpty(content)){
                ((EditText)v).setError("此项不能为空");
            }
        }
    }
}
